package com.seanchenxi.gwt.wordpress.xmlrpc.service.impl;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.seanchenxi.gwt.wordpress.xmlrpc.service.DemoServiceAsync;
import com.seanchenxi.gwt.wordpress.xmlrpc.service.constant.HasDemoServiceMethodNames;
import com.seanchenxi.gwt.xmlrpc.client.XmlRpcClient;
import com.seanchenxi.gwt.xmlrpc.client.XmlRpcRequest;

/**
 * The Class DemoServiceAsyncImpl.
 */
public class DemoServiceAsyncImpl extends XmlRpcClient implements
		DemoServiceAsync, HasDemoServiceMethodNames {

	/**
	 * Instantiates a new demo service async impl.
	 *
	 * @param url the url
	 */
	public DemoServiceAsyncImpl(String url) {
		super(url);
	}

	/* (non-Javadoc)
	 * @see com.seanchenxi.gwt.wordpress.service.DemoServiceAsync#sayHello(com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void sayHello(AsyncCallback<String> callback) {
		XmlRpcRequest<String> xmlRpcRequest = createRequest(SAY_HELLO, "");
		send(xmlRpcRequest, callback);
	}

	/* (non-Javadoc)
	 * @see com.seanchenxi.gwt.wordpress.service.DemoServiceAsync#addTwoNumbers(int, int, com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void addTwoNumbers(int number1, int number2,
			AsyncCallback<Integer> callback) {
		XmlRpcRequest<Integer> xmlRpcRequest = createRequest(SAY_HELLO,
				number1, number2);
		send(xmlRpcRequest, callback);
	}

}
